# ubuntu 16.04 64bit

# REMOTE
apt update
apt install git monit nginx ruby ruby-dev postgresql libpq-dev nodejs
gem install bundler -v '< 2.0'
mkdir -p /var/www/ebpsp/shared/
vi /etc/hosts
vi /var/www/ebpsp/shared/.env
vi /etc/monit/monitrc # 'set httpd' section
sudo service monit restart
su postgres -c psql
# \password
# create database ebpsp_production;
vi /etc/postgresql/9.5/main/pg_hba.conf # 'peer' to 'md5'
sudo service postgresql restart
rm /etc/nginx/sites-enabled/default

# LOCAL
cap yongchang puma:monit:config
cap yongchang puma:nginx_config
cap yongchang deploy

# REMOTE
vi /etc/nginx/sites-enabled/ebpsp_* # listen 80 default_server;
sudo service nginx restart
cd /var/www/ebpsp/current
RAILS_ENV=production rake db:seed

# BACKUP / RESTORE
cap yongchang website:backup
cap yongchang website:restore[yongchang-47.92.34.171-20171224114944]

# LOG
cap yongchang logs
cap yongchang sidekiq:logs